﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head><link rel="stylesheet" href="${ctx}/common/common.css">
    <title>Title</title>
    <link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/style/admin.css" media="all">
    <script src="${ctx}/common/plugins/layuiadmin/layui/layui.js"></script>
    
</head>
<body>
<form class="layui-form"  action="${ctx}/traceProcess/${action}" style="margin-top: 50px">
    <input type="hidden" name="id" value="${entity.id}" />
   	<div class=" layui-form-item layui-col-md5">
        <label class="layui-form-label" style="width: 90px;">溯源流程代码<span style="color: red">*</span></label>
        <div class="layui-input-block">
            <input style="width: 90%;" type="text" name="code" value="${entity.code}"  lay-verify="isNumberCode" placeholder="请输入溯源流程代码" autocomplete="off" class="layui-input">
        </div>
   	</div>
    <div class="layui-form-item layui-col-md5">
        <label class="layui-form-label" style="width: 90px;">溯源流程名称<span style="color: red">*</span></label>
        <div class="layui-input-block">
            <input style="width: 90%;" type="text" name="name" lay-verify="required" value="${entity.name}" placeholder="请输入溯源流程名称" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" id="formBtn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            <button type="button" id="rollback" class="layui-btn layui-btn-primary">返回</button>
        </div>
    </div>
</form>

<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
           layer.load(1, {
                shade: [0.1,'#fff'] //0.1透明度的白色背景
            });
            $("#formBtn").attr("disabled",true);
        });
    });
    layui.use('form', function(){
    	var $ = layui.$;
    	var form = layui.form;
    	 form.verify({
             isNumberCode:function(value, item){
            	 if(value.trim().length<=0){
                     return "必填项不能为空";
                 }
            	 var reg = /^[0-9a-zA-Z]*$/
            	 if(value.trim().length>0){
            		 if (!reg.test(value)) {
            			 return "只能填写数字或字母";
            		 }
                 }
             }
         });
    });
    document.getElementById("rollback").addEventListener("click",function(){
        window.history.back();
    })
</script>
</body>
</html>



